home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!sun2!ua302aa
- From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: A problem with fprintf
- Date: 9 Jan 1996 14:29:18 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4ctu3u$8t9@sparcserver.lrz-muenchen.de>
- References: <4cs8ie$5ru@no-names.nerdc.ufl.edu> <4csdt4$mcn@castle.nando.net> <4cth3m$1c0@yarrow.wt.com.au>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- bvarley@yarrow.wt.com.au (bruce varley) writes:
-
- >In a formal sense the debugger is right. 'src' is not the same as a
- >pointer to a string. &src[0] is closer to being formally right, if src
- >is type char. If the debugger is REALLY finicky, it might go off
- >hunting for the null and spit the dummy if it doesn't find it.
-
- If src is an array, there is no difference between the expression
- "src" and the expression "&src[0]" if those expressions are used
- as arguments in a function call.
-
- >One solution is to use pointers. char* is the right way to point to
- >the string to be output.
-
- >Not all compilers are this fussy.
-
- Compilers that pass different pointer to func() in one of the
- following three situations are not extremely fuzzy, they are
- plain wrong:
-
- char arg[5];
-
- Situation 1:
-
- func(arg);
-
- Situation 2:
-
- func(&arg[0]);
-
- Situation 3:
-
- {
- char *p;
-
- p = &arg[0];
- func(p);
- }
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-